package org.dong.base.thread;

public class ThreadDemo2 {
    private static final ThreadLocal global_str = new ThreadLocal();

    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            System.out.println("开始执行到线程业务逻辑");
            throw new RuntimeException("发生异常啦");
        });
        t1.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread t, Throwable e) {
                System.out.println("线程"+t.getName()+"发生了异常:"+e.getMessage());
            }
        });
        t1.start();
        System.out.println("我是主线程");
    }
}
